#ifndef SOLUTION_H_
#define SOLUTION_H_
class Solution 
{
public:
    double pow(double x, int n) 
	{
        // Start typing your C/C++ solution below
        // DO NOT write int main() function
        if(n==0)
		{
			return 1;
		}

		typedef unsigned int uint;
		uint abn = (n>0)?n:(~n+1);

		double result = 1, y = x;
		while(abn>0)
		{
			if(abn%2)
			{
				result *= y;
			}
			y*=y;
			abn>>=1;
		}


		return (n<0)?1/result:result;
    }
};
#endif